﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using MKDataBase.Implementation;
using MKDataBase.Contracts;
using System.IO;

namespace MK_Movie_Manager
{
    static class Program
    {

        static IDBProvider movieDB;

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            
           /* if (Properties.Settings.Default.UseXMLAsDB)
            {
                CreateImageFolder();
                movieDB = new XMLDBProvider();
            }
            else
                movieDB = new SqlDBProvider();*/

            CreateImageFolder();
            movieDB = XMLDBProvider.GetInstance;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            SetupSettings();
            Application.Run(new MKMovieManager_MainForm());
        }

        private static void SetupSettings()
        {
            MMSettings.CurrentDBInstance = movieDB;
        }

        private static void CreateImageFolder()
        {
            //Verify if Image Directory exists
            DirectoryInfo dir = new DirectoryInfo(Directory.GetCurrentDirectory() + "\\Images");
            if(!dir.Exists)
                Directory.CreateDirectory(Directory.GetCurrentDirectory()+"\\Images");
        }
    }
    static class MMSettings
    {
        public static IDBProvider CurrentDBInstance;
    }
}
